import { wxshare } from 'service/share';
import { addRcmInfo, addAdminCode } from 'api/user'

//微信分享的mixin
var wxshareMixin = {
  mounted() {
    // console.log( wxshare );
    // console.log('mixin handle called!:',window.location.href);
    wxshare();
    if (this.$router.currentRoute.query.tpAdminCode) {
      addRcmInfo({
        tpAdminCode: this.$router.currentRoute.query.tpAdminCode,
        tpMacAddress: this.$router.currentRoute.query.mac
      })
    }
    if (this.$router.currentRoute.query.code) {
      addRcmInfo({
        referrerCode: this.$router.currentRoute.query.code
      })
    }
    if (this.$router.currentRoute.query.adminCode) {
      addAdminCode({
        adminCode: this.$router.currentRoute.query.adminCode
      })
    }

  }
}


export {
  wxshareMixin as wxshare
}
